#include<iostream>
#include<stack>
using namespace std;
void _calculate(stack<int>& num,stack<char>& sym) {
	int right = num.top(); num.pop();
	int left = num.top(); num.pop();
	int sum;
	switch(sym.top()){
	case '+':sym.pop(); 
		    if (!sym.empty()&&sym.top() == '-')sum = left - right;
			else sum = left + right;
		    break;
	case'-':sym.pop();
		    if (!sym.empty() && sym.top() == '-')sum = left + right;
		    else sum = left - right;
		    break;
	case '*':sum = left * right; sym.pop(); break;
	case '/':sum = left / right; sym.pop(); break;
	default:break;
	}
	num.push(sum);
}
int main() {
	stack<int> number;
	stack<char> symbol;
	string calculate;
	cin >> calculate;
	for (int i = 0;i<calculate.size(); i++) {
		if(calculate[i] >= '0' && calculate[i] <= '9')
		{
			int sum = 0;
			while (calculate[i] >= '0' && calculate[i] <= '9') {
				sum = sum * 10 + (calculate[i++] - '0');
			}
			number.push(sum);
			i--;
		}
		else if(calculate[i]=='+'|| calculate[i] == '-'){
			while (!symbol.empty() && (symbol.top() == '*' || symbol.top() == '/')) {
				_calculate(number, symbol);
			}
			symbol.push(calculate[i]);
		}
		else if (calculate[i] == '*' || calculate[i] == '/'){
			symbol.push(calculate[i]);
		}
		else if (calculate[i] == '(') { symbol.push(calculate[i]); }
		else if (calculate[i] == ')') {
			while (!symbol.empty()&&symbol.top() != '(') {
				_calculate(number, symbol);
			}
			symbol.pop();
		}
	}
	while (!symbol.empty()) { _calculate(number, symbol); }
	cout << number.top();
}